<?php
declare(strict_types=1);

namespace App\Models\Message;
use App\Models\BaseModel;

class TemplateConfig extends BaseModel
{
    protected  $table = "template_config";

    protected $fillable = [
        "uid",
        "title",
        "template_id",
        "is_show",
        "values",
        "remark",
        "navigator",
    ];

    public function getValuesAttribute($value): array
    {
        return array_values(json_decode($value, true) ?: []);
    }

    public function setValuesAttribute($value)
    {
        $this->attributes['values'] = json_encode(array_values($value));
    }

}
